home *** CD-ROM | disk | FTP | other *** search
- /*==================================================================
- File: MacOS_UAppleEvents.h
-
- Contains: AppleEvent utility classes.
-
- Written by: Ed Reed
-
- Copyright: © 1999 Connectix Corporation
- ==================================================================*/
-
- #pragma once
-
- #include "MacOS_AppleEventUtils.h"
- #include "MacOS_ConnectixUtils.h"
- #include "MacOS_Namespaces.h"
- #include "MacOS_UAppleEventTraits.h"
-
- #ifndef __AEDATAMODEL__
- #include <AEDataModel.h>
- #endif
-
- #ifndef __AEOBJECTS__
- #include <AEObjects.h>
- #endif
-
- #ifndef __AEREGISTRY__
- #include <AERegistry.h>
- #endif
-
- #ifndef __ERRORS__
- #include <Errors.h>
- #endif
-
- #ifndef __PROCESSES__
- #include <Processes.h>
- #endif
-
- #pragma options align=mac68k
-
-
- CTX_Begin_Namespace_MacOS
-
-
- /*******************************************************************
- FORWARD DECLARATIONS
- *******************************************************************/
-
- class AEDescriptor;
- class AEToken;
- class AEObjSpecifier;
- class AEDescriptorList;
- class AEDescriptorRecord;
- class AEAppleEvent;
-
- /*******************************************************************
- CONSTANTS
- *******************************************************************/
-
- typedef struct AESuppressCreate {int ignore; } AESuppressCreate;
-
- const AESuppressCreate kAESuppressCreate = {0};
- const AEDesc kAENullDescriptor = {typeNull, NULL};
-
- /*******************************************************************
- TYPE/CLASS DEFINTIONS
- *******************************************************************/
-
- /*------------------------------------------------------------------
- AEDescriptor
- ------------------------------------------------------------------*/
-
- #pragma mark class AEDescriptor
-
- class AEDescriptor : public AEDesc
- {
- public:
- /* Constructors & Destructor */
- AEDescriptor(void) { descriptorType = typeNull; dataHandle = NULL; }
- AEDescriptor(const AEDesc & inAEDesc);
- AEDescriptor(DescType inType, const void * inData, Size inSize);
- AEDescriptor(DescType inType, Handle inData);
- AEDescriptor(DescType inType);
-
- ~AEDescriptor(void) { ::AEDisposeDesc(this); }
-
- /* Assignment Methods */
- OSErr AssignDesc(const AEDesc & inAEDesc);
-
- OSErr Assign(DescType inType, const void * inData, Size inSize);
- OSErr Assign(DescType inDataType, Handle inHandle);
- template <typename _Type>
- OSErr Assign(const _Type & inValue)
- {
- return Assign(AEDescriptorTraits<_Type>::kDescriptorType, &inValue, AEDescriptorTraits<_Type>::GetSize(inValue));
- }
- template <typename _Type>
- OSErr Assign(DescType inType, const _Type & inValue)
- {
- return Assign(inType, &inValue, AEDescriptorTraits<_Type>::GetSize(inValue));
- }
-
- /* Data Access Methods */
- OSErr GetData(DescType inType, void * outData, Size inSize) const
- {
- if (descriptorType != inType)
- return paramErr;
- #if TARGET_API_MAC_CARBON
- ::AEGetDescData(this, outData, inSize);
- #else
- ::BlockMoveData(*dataHandle, outData, inSize);
- #endif
- return noErr;
- }
- template <typename _Type>
- OSErr GetData(_Type & outValue) const
- {
- if (descriptorType != AEDescriptorTraits<_Type>::kDescriptorType)
- return paramErr;
- outValue = **reinterpret_cast<const _Type**>(dataHandle);
- return noErr;
- }
- template <typename _Type>
- OSErr GetData(DescType inType, _Type & outValue) const
- {
- if (descriptorType != inType)
- return paramErr;
- outValue = **reinterpret_cast<const _Type**>(dataHandle);
- return noErr;
- }
-
- OSErr GetCString(char * outCString, Size inMaxLength) const;
- OSErr GetPString(StringPtr outPString, Size inMaxLength = kPascalStringMaxLength) const;
-
- /* Coercion Methods */
- OSErr CoerceToDesc(DescType inDesiredType, AEDesc & outDesc) const
- {
- return CTX_MacOS::CoerceDesc(this, inDesiredType, &outDesc);
- }
- template <typename _Type>
- OSErr CoerceTo(_Type & outValue) const
- {
- OSErr status;
- AEDescriptor coercedValue;
-
- status = CoerceToDesc(AEDescriptorTraits<_Type>::kDescriptorType, coercedValue);
- if (status == noErr)
- status = coercedValue.GetData(outValue);
- return status;
- }
- template <typename _Type>
- OSErr CoerceTo(DescType inDesiredType, _Type & outValue) const
- {
- OSErr status;
- AEDescriptor coercedValue;
-
- status = CoerceToDesc(inDesiredType, coercedValue);
- if (status == noErr)
- status = coercedValue.GetData(inDesiredType, outValue);
- return status;
- }
-
- /* Object Specifier Resolution Methods */
- OSErr Resolve(AEDesc & outDesc, SInt16 inFlags = kAEIDoMinimum)
- {
- return CTX_MacOS::ResolveAEParameter(this, &outDesc, inFlags);
- }
-
- /* Miscellaneous Accessors */
- DescType GetType(void) const { return descriptorType; }
-
- Size GetDataSize(void) const
- {
- return GetAEDescDataSize(*this);
- }
-
- bool IsNull() const { return (descriptorType == typeNull); }
-
- bool IsNotNull() const { return (descriptorType != typeNull); }
- };
-
- /*------------------------------------------------------------------
- TAEDescriptor
- ------------------------------------------------------------------*/
-
- #pragma mark class TAEDescriptor
-
- template <typename _Type>
- struct TAEDescriptor : public AEDescriptor
- {
- public:
- /* Constructors & Destructor */
- TAEDescriptor(const _Type & inValue)
- : AEDescriptor(AEDescriptorTraits<_Type>::kDescriptorType, &inValue, AEDescriptorTraits<_Type>::GetSize(inValue))
- {
- }
-
- TAEDescriptor(DescType inType, const _Type & inValue)
- : AEDescriptor(inType, &inValue, AEDescriptorTraits<_Type>::GetSize(inValue))
- {
- }
-
- private:
- TAEDescriptor();
- };
-
- /*------------------------------------------------------------------
- AEToken
- ------------------------------------------------------------------*/
-
- #pragma mark class AEToken
-
- class AEToken : public AEDesc
- {
- public:
- /* Constructors & Destructor */
- AEToken(void) { descriptorType = typeNull; dataHandle = NULL; }
-
- ~AEToken(void) { ::AEDisposeToken(this); }
-
- /* Data Access Methods */
- template <typename _Type>
- OSErr GetData(_Type & outValue) const
- {
- if (descriptorType != AEDescriptorTraits<_Type>::kDescriptorType)
- return paramErr;
- outValue = **reinterpret_cast<const _Type**>(dataHandle);
- return noErr;
- }
- template <typename _Type>
- OSErr GetData(DescType inType, _Type & outValue) const
- {
- if (descriptorType != inType)
- return paramErr;
- outValue = **reinterpret_cast<const _Type**>(dataHandle);
- return noErr;
- }
-
- /* Miscellaneous Accessors */
- DescType GetType() const { return descriptorType; }
- Size GetDataSize(void) const
- {
- return GetAEDescDataSize(*this);
- }
-
- private:
-
- AEToken(const AEDesc & inAEDesc);
- AEToken(DescType inType, const void * inData, Size inSize);
- AEToken(DescType inType, Handle inData);
- };
-
- /*------------------------------------------------------------------
- AEDescriptorList
- ------------------------------------------------------------------*/
-
- #pragma mark class AEDescriptorList
-
- class AEDescriptorList : public AEDescriptor
- {
- friend class AEDescriptorRecord;
- public:
- /* Constructors & Destructor */
- explicit AEDescriptorList(const AEDesc & inAEDesc);
- explicit AEDescriptorList(const AEDescriptorList & inAEDesc);
- AEDescriptorList(const void* inFactoringPtr = NULL, Size inSize = 0);
-
- /* Methods to Add Items to the List */
- OSErr PutItemDesc(const AEDesc& inDesc, SInt32 inIndex = 0)
- {
- return ::AEPutDesc(this, inIndex, &inDesc);
- }
-
- OSErr PutItem(DescType inType, const void* inData, Size inSize, SInt32 inIndex = 0)
- {
- return ::AEPutPtr(this, inIndex, inType, inData, inSize);
- }
- template <typename _Type>
- OSErr PutItem(const _Type & inValue, SInt32 inIndex = 0)
- {
- return PutItem(AEDescriptorTraits<_Type>::kDescriptorType, &inValue, AEDescriptorTraits<_Type>::GetSize(inValue), inIndex);
- }
- template <typename _Type>
- OSErr PutItem(DescType inDataType, const _Type & inValue, SInt32 inIndex = 0)
- {
- return PutItem(inDataType, &inValue, AEDescriptorTraits<_Type>::GetSize(inValue), inIndex);
- }
-
- OSErr PutCStringItem(const char * outCString, SInt32 inIndex = 0);
- OSErr PutPStringItem(ConstStringPtr outPString, SInt32 inIndex = 0);
- OSErr PutBooleanItem(Boolean inBool, SInt32 inIndex = 0);
-
- /* Methods to Retrieve Items from the List */
- OSErr GetItemDesc(SInt32 inIndex, DescType inDesiredType, AEDesc & outDesc) const
- {
- AEKeyword ignore;
- return ::AEGetNthDesc(this, inIndex, inDesiredType, &ignore, &outDesc);
- }
-
- OSErr GetItem(SInt32 inIndex, DescType& ioType, void* outData, Size inSize) const
- {
- AEKeyword ignore;
- Size actualSize;
- return ::AEGetNthPtr(this, inIndex, ioType,
- &ignore, &ioType, outData, inSize, &actualSize);
- }
- template <typename _Type>
- OSErr GetItem(SInt32 inIndex, _Type & outValue) const
- {
- DescType type = AEDescriptorTraits<_Type>::kDescriptorType;
- return GetItem(inIndex, type, &outValue, AEDescriptorTraits<_Type>::GetMaxSize());
- }
- template <typename _Type>
- OSErr GetItem(SInt32 inIndex, DescType inType, _Type & outValue) const
- {
- DescType type = inType;
- return GetItem(inIndex, type, &outValue, AEDescriptorTraits<_Type>::GetMaxSize());
- }
-
- OSErr GetCStringItem(SInt32 inIndex, char * outCString, Size inMaxLength);
- OSErr GetPStringItem(SInt32 inIndex, StringPtr outPString, Size inMaxLength = kPascalStringMaxLength);
- OSErr GetBooleanItem( SInt32 inIndex, Boolean& outBoolean );
-
- /* Methods to Get Information on Items in the List */
- Size GetItemSize(SInt32 inIndex)
- {
- DescType type;
- Size actualSize;
- return ::AESizeOfNthItem(this, inIndex, &type, &actualSize) == noErr
- ? actualSize
- : 0;
- }
- SInt32 CountItems(void) const
- {
- SInt32 count;
- return ::AECountItems(this, &count) == noErr ? count : 0;
- }
-
- protected:
- AEDescriptorList(const AESuppressCreate& /* inAESuppressCreate */)
- : AEDescriptor()
- {
- }
- };
-
- /*------------------------------------------------------------------
- AEDescriptorRecord
- ------------------------------------------------------------------*/
-
- #pragma mark class AEDescriptorRecord
-
- class AEDescriptorRecord : public AEDescriptorList
- {
- public:
- /* Constructors & Destructor */
- AEDescriptorRecord(const void* inFactoringPtr = NULL, Size inSize = 0);
- explicit AEDescriptorRecord(const AEDesc & inAEDesc);
- explicit AEDescriptorRecord(const AEDescriptorRecord & inAEDesc);
-
- /* Methods to Add Keyworded Items to the Record */
- OSErr PutKeyDesc(AEKeyword inKey, const AEDesc & inDesc)
- {
- return ::AEPutKeyDesc(this, inKey, &inDesc);
- }
-
- OSErr PutKey(AEKeyword inKey, DescType inType, const void* inData, Size inSize)
- {
- return ::AEPutKeyPtr(this, inKey, inType, inData, inSize);
- }
- template <typename _Type>
- OSErr PutKey(AEKeyword inKey, const _Type & inValue)
- {
- return PutKey(inKey, AEDescriptorTraits<_Type>::kDescriptorType, &inValue, AEDescriptorTraits<_Type>::GetSize(inValue));
- }
- template <typename _Type>
- OSErr PutKey(AEKeyword inKey, DescType inType, const _Type & inValue)
- {
- return PutKey(inKey, inType, &inValue, AEDescriptorTraits<_Type>::GetSize(inValue));
- }
-
- OSErr PutCStringKey(AEKeyword inKey, const char * outCString);
- OSErr PutPStringKey(AEKeyword inKey, ConstStringPtr outPString);
-
- /* Methods to Retrieve Keyworded Items from the Record */
- OSErr GetKeyDesc(AEKeyword inKey, DescType inDesiredType, AEDesc & outDesc) const
- {
- return ::AEGetKeyDesc(this, inKey, inDesiredType, &outDesc);
- }
-
- OSErr GetKey(AEKeyword inKey, DescType& ioType, void* outData, Size inSize) const
- {
- Size actualSize;
- return ::AEGetKeyPtr(this, inKey, ioType, &ioType, outData, inSize, &actualSize);
- }
- template <typename _Type>
- OSErr GetKey(AEKeyword inKey, _Type & outValue) const
- {
- DescType type = AEDescriptorTraits<_Type>::kDescriptorType;
- return GetKey(inKey, type, &outValue, AEDescriptorTraits<_Type>::GetMaxSize());
- }
- template <typename _Type>
- OSErr GetKey(AEKeyword inKey, DescType inType, _Type & outValue) const
- {
- DescType type = inType;
- return GetKey(inKey, type, &outValue, AEDescriptorTraits<_Type>::GetMaxSize());
- }
-
- OSErr GetCStringKey(AEKeyword inKey, char * outCString, Size inMaxLength);
- OSErr GetPStringKey(AEKeyword inKey, StringPtr outPString, Size inMaxLength = kPascalStringMaxLength);
-
- /* Methods to Get Information on Keyworded Items in the List */
- Size GetKeySize(AEKeyword inKey) const
- {
- DescType type;
- Size actualSize;
- return ::AESizeOfKeyDesc(this, inKey, &type, &actualSize) == noErr
- ? actualSize
- : 0;
- }
-
- /* Methods to Retrieve Indexed Items from the Record */
- OSErr GetItemDesc(SInt32 inIndex, DescType inDesiredType, AEKeyword & outKeyword, AEDesc & outDesc) const
- {
- return ::AEGetNthDesc(this, inIndex, inDesiredType, &outKeyword, &outDesc);
- }
-
- OSErr GetItem(SInt32 inIndex, DescType& ioType, AEKeyword& outKeyword, void* outData, Size inSize) const
- {
- Size actualSize;
- return ::AEGetNthPtr(this, inIndex, ioType,
- &outKeyword, &ioType, outData, inSize, &actualSize);
- }
- template <typename _Type>
- OSErr GetItem(SInt32 inIndex, AEKeyword & outKeyword, _Type & outValue) const
- {
- DescType type = AEDescriptorTraits<_Type>::kDescriptorType;
- return GetItem(inIndex, type, outKeyword, &outValue, AEDescriptorTraits<_Type>::GetMaxSize());
- }
-
- protected:
- AEDescriptorRecord(const AESuppressCreate& inAESuppressCreate)
- : AEDescriptorList(inAESuppressCreate)
- {
- }
-
- };
-
-
- /*------------------------------------------------------------------
- AEObjSpecifier
- ------------------------------------------------------------------*/
-
- #pragma mark class AEObjSpecifier
-
- class AEObjSpecifier : public AEDescriptorRecord
- {
- public:
- AEObjSpecifier(
- DescType inDesiredClass,
- DescType inKeyForm,
- const AEDesc& inKeyData,
- const AEDesc& inContainer = kAENullDescriptor);
- };
-
- /*------------------------------------------------------------------
- AEAppleEvent
- ------------------------------------------------------------------*/
-
- #pragma mark class AEAppleEvent
-
- class AEAppleEvent : public AEDescriptorRecord
- {
- public:
- AEAppleEvent( AEEventClass inAEClass,
- AEEventID inAEEventID,
- const AEDesc& inTarget,
- AEReturnID inReturnID = kAutoGenerateReturnID,
- AETransactionID inTransactionID = kAnyTransactionID)
- : AEDescriptorRecord(kAESuppressCreate)
- {
- MakeAppleEvent(inAEClass, inAEEventID, inTarget, inReturnID, inTransactionID);
- }
- AEAppleEvent( AEEventClass inAEClass,
- AEEventID inAEEventID,
- const ProcessSerialNumber& inTarget,
- AEReturnID inReturnID = kAutoGenerateReturnID,
- AETransactionID inTransactionID = kAnyTransactionID);
- AEAppleEvent( AEEventClass inAEClass,
- AEEventID inAEEventID,
- OSType inSignature,
- AEReturnID inReturnID = kAutoGenerateReturnID,
- AETransactionID inTransactionID = kAnyTransactionID);
- AEAppleEvent();
-
- /* copy constructors */
- explicit AEAppleEvent(const AEDesc & inOriginal);
- explicit AEAppleEvent(const AEAppleEvent & inOriginal);
-
- OSErr Send( AEDesc& outReply,
- AESendMode inSendMode = kAECanInteract+kAECanSwitchLayer+kAEWaitReply,
- AESendPriority inPriority = kAENormalPriority,
- SInt32 inTimeout = kAEDefaultTimeout,
- AEIdleUPP inIdleProc = NULL,
- AEFilterUPP inEventFilter = NULL) const
- {
- return ::AESend(this,
- &outReply,
- inSendMode,
- inPriority,
- inTimeout,
- inIdleProc,
- inEventFilter);
- }
- OSErr Send( AESendMode inSendMode = kAECanInteract+kAECanSwitchLayer,
- AESendPriority inPriority = kAENormalPriority,
- SInt32 inTimeout = kAEDefaultTimeout,
- AEIdleUPP inIdleProc = NULL,
- AEFilterUPP inEventFilter = NULL) const
- {
- AEDesc ignore;
- return ::AESend(this,
- &ignore,
- (inSendMode&0xFFFFFFF0)|kAENoReply,
- inPriority,
- inTimeout,
- inIdleProc,
- inEventFilter);
- }
-
-
- /* Methods to create an AppleEvent (sometimes needed if default contructor was used).*/
- void MakeAppleEvent( AEEventClass inEventClass, AEEventID inEventID, const AEDesc& inTarget,
- AEReturnID inReturnID = kAutoGenerateReturnID, AETransactionID inTransactionID = kAnyTransactionID );
-
- /* Methods to Add Parameters from the AppleEvent */
- OSErr PutParameterDesc(AEKeyword inKey, const AEDesc& inDesc)
- {
- return ::AEPutParamDesc(this, inKey, &inDesc);
- }
-
- OSErr PutParameter(AEKeyword inKey, DescType inType, const void* inData, Size inSize)
- {
- return ::AEPutParamPtr(this, inKey, inType, inData, inSize);
- }
- template <typename _Type>
- OSErr PutParameter(AEKeyword inKey, const _Type & inValue)
- {
- return PutParameter(inKey, AEDescriptorTraits<_Type>::kDescriptorType, &inValue, AEDescriptorTraits<_Type>::GetSize(inValue));
- }
- template <typename _Type>
- OSErr PutParameter(AEKeyword inKey, DescType inType, const _Type & inValue)
- {
- return PutParameter(inKey, inType, &inValue, AEDescriptorTraits<_Type>::GetSize(inValue));
- }
-
- /* Methods to Retrieve Parameters from the AppleEvent */
- OSErr GetParameterDesc(AEKeyword inKey, DescType inDesiredType, AEDesc & outDesc) const
- {
- return ::AEGetParamDesc(this, inKey, inDesiredType, &outDesc);
- }
-
- OSErr GetParameter(AEKeyword inKey, DescType& ioType, void* outData, Size inSize) const
- {
- Size actualSize;
- return ::AEGetParamPtr(this, inKey, ioType, &ioType, outData, inSize, &actualSize);
- }
- template <typename _Type>
- OSErr GetParameter(AEKeyword inKey, _Type & outValue) const
- {
- DescType type = AEDescriptorTraits<_Type>::kDescriptorType;
- return GetParameter(inKey, type, &outValue, AEDescriptorTraits<_Type>::GetMaxSize());
- }
- template <typename _Type>
- OSErr GetParameter(AEKeyword inKey, DescType inType, _Type & outValue) const
- {
- DescType type = inType;
- return GetParameter(inKey, type, &outValue, AEDescriptorTraits<_Type>::GetMaxSize());
- }
-
- /* Methods to Get Information on Parameters in the AppleEvent */
- Size GetParameterSize(AEKeyword inKey) const
- {
- DescType type;
- Size actualSize;
- return ::AESizeOfParam(this, inKey, &type, &actualSize) == noErr
- ? actualSize
- : 0;
- }
-
- /* Methods to Set AppleEvent Attributes */
- OSErr PutAttributeDesc(AEKeyword inKey, const AEDesc& inDesc)
- {
- return ::AEPutAttributeDesc(this, inKey, &inDesc);
- }
-
- OSErr PutAttribute(AEKeyword inKey, DescType inType, const void* inData, Size inSize)
- {
- return ::AEPutAttributePtr(this, inKey, inType, inData, inSize);
- }
- template <typename _Type>
- OSErr PutAttribute(AEKeyword inKey, const _Type & inValue)
- {
- return PutAttribute(inKey, AEDescriptorTraits<_Type>::kDescriptorType, &inValue, AEDescriptorTraits<_Type>::GetSize(inValue));
- }
- template <typename _Type>
- OSErr PutAttribute(AEKeyword inKey, DescType inType, const _Type & inValue)
- {
- return PutAttribute(inKey, inType, &inValue, AEDescriptorTraits<_Type>::GetSize(inValue));
- }
-
- /* Methods to Get AppleEvent Attributes */
- OSErr GetAttributeDesc(AEKeyword inKeyword, DescType inType, AEDesc & outAttribute) const
- {
- return ::AEGetAttributeDesc(this, inKeyword, inType, &outAttribute);
- }
- OSErr GetAttribute(AEKeyword inKeyword, DescType inType, void * outData, Size inSize) const
- {
- DescType type;
- Size actualSize;
- return ::AEGetAttributePtr(this, inKeyword, inType, &type, outData, inSize, &actualSize);
- }
- template <typename _Type>
- OSErr GetAttribute(AEKeyword inKeyword, _Type & outData) const
- {
- return GetAttribute(inKeyword, AEDescriptorTraits<_Type>::kDescriptorType, &outData, AEDescriptorTraits<_Type>::GetMaxSize());
- }
- template <typename _Type>
- OSErr GetAttribute(AEKeyword inKeyword, DescType inType, _Type & outData) const
- {
- return GetAttribute(inKeyword, inType, &outData, AEDescriptorTraits<_Type>::GetMaxSize());
- }
-
- /* Methods to Get Information on Attributes in the AppleEvent */
- Size GetAttributeSize(AEKeyword inKey) const
- {
- DescType type;
- Size actualSize;
- return ::AESizeOfAttribute(this, inKey, &type, &actualSize) == noErr
- ? actualSize
- : 0;
- }
-
- /* Miscellaneous Accessors */
- OSErr GetClass(AEEventClass & outClass) const
- {
- DescType type = typeType;
- return GetAttribute(keyEventClassAttr, type, outClass);
- }
- OSErr GetEventID(AEEventID & outID) const
- {
- DescType type = typeType;
- return GetAttribute(keyEventIDAttr, type, outID);
- }
- OSErr GetSource(SInt16 & outSource) const
- {
- return GetAttribute(keyEventSourceAttr, outSource);
- }
- };
-
- /*------------------------------------------------------------------
- AEDescriptorTraits<>
- ------------------------------------------------------------------*/
-
- // Disallow automatic template instantiation for the following types
- DeclareBogusAEDescriptorTrait_(AEDescriptor);
- DeclareBogusAEDescriptorTrait_(AEToken);
- DeclareBogusAEDescriptorTrait_(AEDescriptorList);
- DeclareBogusAEDescriptorTrait_(AEDescriptorRecord);
- DeclareBogusAEDescriptorTrait_(AEAppleEvent);
-
- /*******************************************************************
- FUNCTIONS
- *******************************************************************/
-
- #pragma mark -
- #pragma mark === FUNCTIONS ===
-
- inline AEDescriptor &
- GetAEDescriptorOf(AEDesc & inAEDesc)
- {
- return static_cast<AEDescriptor &>(inAEDesc);
- }
- inline const AEDescriptor &
- GetAEDescriptorOf(const AEDesc & inAEDesc)
- {
- return static_cast<const AEDescriptor &>(inAEDesc);
- }
-
- inline AEToken &
- GetAETokenOf(AEDesc & inAEDesc)
- {
- return static_cast<AEToken &>(inAEDesc);
- }
-
- // fix me -- the static_cast form apparently constructs an AEToken
- // object when compiled with CW 6. Note that this fails because
- // the required constructor is private (and unimplemented).
- // AEDescriptor has a constructor, and if it's getting called
- // in the corresponding inline above, there may be a memory leak.
-
- inline const AEToken &
- GetAETokenOf(const AEDesc & inAEDesc)
- {
- #if __MWERKS__ >= 0x2400
- return reinterpret_cast<const AEToken &>(inAEDesc);
- #else
- return static_cast<const AEToken &>(inAEDesc);
- #endif
- }
-
- inline AEDescriptorList &
- GetAEDescriptorListOf(AEDescList & inAEDesc)
- {
- return static_cast<AEDescriptorList &>(inAEDesc);
- }
- inline const AEDescriptorList &
- GetAEDescriptorListOf(const AEDescList & inAEDesc)
- {
- return static_cast<const AEDescriptorList &>(inAEDesc);
- }
-
- inline AEDescriptorRecord &
- GetAEDescriptorRecordOf(AEDescList & inAEDesc)
- {
- return static_cast<AEDescriptorRecord &>(inAEDesc);
- }
- inline const AEDescriptorRecord &
- GetAEDescriptorRecordOf(const AEDescList & inAEDesc)
- {
- return static_cast<const AEDescriptorRecord &>(inAEDesc);
- }
-
- inline AEObjSpecifier &
- GetAEObjSpecifierOf(AEDesc & inAEDesc)
- {
- return static_cast<AEObjSpecifier &>(inAEDesc);
- }
- inline const AEObjSpecifier &
- GetAEObjSpecifierOf(const AEDesc & inAEDesc)
- {
- return static_cast<const AEObjSpecifier &>(inAEDesc);
- }
-
- inline AEAppleEvent &
- GetAEAppleEventOf(AppleEvent & inAppleEvent)
- {
- return static_cast<AEAppleEvent &>(inAppleEvent);
- }
- inline const AEAppleEvent &
- GetAEAppleEventOf(const AppleEvent & inAppleEvent)
- {
- return static_cast<const AEAppleEvent &>(inAppleEvent);
- }
-
- /*******************************************************************
- MORE CONSTANTS
- *******************************************************************/
-
- extern const TAEDescriptor<Boolean> kAETrueDescriptor;
- extern const TAEDescriptor<Boolean> kAEFalseDescriptor;
- extern const TAEDescriptor<ProcessSerialNumber> kAEThisProcessDescriptor;
-
- #pragma options align=reset
-
-
- CTX_End_Namespace_MacOS
-
-
- /*==================================================================
- Change History (most recent first):
-
- $Log: MacOS_UAppleEvents.h,v $
- ==================================================================*/
-